All you have to do is copy the information to the blanks.
Here is the applet with all the blanks filled in. With skillful use of the text editor, much of this filling in is easily done using "copy" and "paste". The applet creates the above drawing.
import javax.swing.JApplet; import java.awt.*; // assume that the drawing area is 350 by 250 public class HouseRectangles extends JApplet { final int width = 350, height = 250; final int houseX = 50, houseY = 100, houseW = 150, houseH = 100 ; final int doorX = 120, doorY = 150, doorW = 20, doorH = 50 ; final int lWindX = 75, lWindY = 140, lWindW = 25, lWindH = 40 ; final int rWindX = 160, rWindY = 140, rWindW = 25, rWindH = 40 ; final int trunkX = 260, trunkY = 65, trunkW = 10, trunkH = 100 ; public void paint ( Graphics gr ) { gr.setColor( Color.white ); // set the pen color to white gr.fillRect( 0, 0, 350, 250 ); // fill the drawing area with white gr.setColor( Color.orange ); // set the pen color to orange gr.drawRect( doorX , doorY , doorW , doorH ); // door gr.drawRect( lWindX , lWindY , lWindW, lWindH); // lwind gr.drawRect( rWindX , rWindY , rWindW, rWindH); // rwind gr.drawRect( trunkX , trunkY , trunkW, trunkH); // trunk } }
It is tedious to read off all those coordinates from graph paper. It would be better to have the program calculate some of them. You want the door horizontally centered in the house.
houseX
, and houseW
what is the X value of the center of the house?doorW
,
what is the X value of the left edge of the door, doorX
?